package com.itheima.string;
//随机生成验证码，包含大小写字母和数字
public class StringTest5 {
    public static void main(String[] args) {
        String code = getRandomString(6);
        System.out.println(code);
    }
    public static String getRandomString(int length){
        String code ="";
        String data = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

        for(int i=0;i<length;i++){
            code += data.charAt((int)(Math.random()*data.length()));
        }
        return code;
    }

}
